import request from '@/utils/request'

// 分页条件查询
export function getsensorList(data) {
  if (data.baseName == '') {
    return request({
      url: `/weatherStation/page?sensorName=${data.sensorName}&limit=${data.limit}&page=${data.page}`,
      method: 'get'
    })
  }
  if (data.baseName != '') {
    return request({
      url: `/weatherStation/page?sensorName=${data.sensorName}&baseName=${data.baseName}&limit=${data.limit}&page=${data.page}`,
      method: 'get'
    })
  }
}

// 新增
export function addsensorList(data) {
  return request({
    url: '/weatherStation/insert',
    method: 'post',
    data
  })
}

// 删除
export function deletesensorList(data) {
  return request({
    url: `/weatherStation/deleteONe/${data.weatherStationId}`,
    method: 'post'
  })
}

// 批量删除
export function deletesensorLists(data) {
  return request({
    url: `/weatherStation/deleteList?ids%5B%5D=${data.item}`,
    method: 'post'
  })
}

// 更新数据
export function updatesensorList(data) {
  return request({
    url: '/weatherStation/update',
    method: 'post',
    data
  })
}

// 上传
export function uploadweatherList(data) {
  return request({
    url: `/weatherStation/uploadFile`,
    method: 'post',
    headers: {
      'Content-Type': 'multipart/form-data'
    },
    data: data
  })
}
